set more off
clear

do set_path.do

***** Fig 1: Benchmark CIP during transition *****

use "${datadir}cip_all_both.dta", clear

keep if date>=mdy(1,1,2020) & date<=mdy(6,30,2025)

levelsof group
foreach gr in `r(levels)' {
	levelsof currency if group=="`gr'"
	foreach curr in `r(levels)' {
		twoway (tsline sofr_cip ibor_cip if currency=="`curr'" & tenor=="5y", cmissing(no) lwidth(medium medium) lcolor(red blue)), ///
		ylabel(,labsize(small) nogrid) xlabel(,labsize(small) format(%tdCY) nogrid) xtitle("") ytitle("") legend(pos(6) rows(1) size(medium) label(1 "Alternative Benchmark") label(2 "IBOR") order(2 1))  ///
		subtitle(, size(small) ring(0) pos(1) nobexpand) ///
		note("") legend(pos(6) rows(1) size(small)) name("`gr'_`curr'_5y", replace) title("`curr'", size(medium))
		
	}
}

grc1leg g10_AUD_5y g10_CAD_5y g10_CHF_5y g10_DKK_5y g10_EUR_5y g10_GBP_5y g10_JPY_5y g10_NOK_5y g10_NZD_5y g10_SEK_5y, cols(3) rows(4)
graph export "${outdir}figures/5y_g10_combined.pdf", replace

grc1leg eme_CLP_5y eme_CNH_5y eme_CNY_5y eme_COP_5y eme_HUF_5y eme_IDR_5y eme_INR_5y eme_KRW_5y eme_MXN_5y eme_MYR_5y eme_PEN_5y eme_PHP_5y eme_PLN_5y eme_THB_5y eme_TRY_5y eme_ZAR_5y, cols(4)
graph export "${outdir}figures/5y_eme_combined.pdf", replace

graph close _all
